package org.balthie.cal.impl.calculator;

import static org.balthie.cal.core.AbsCalculator.StandardInputerKey.Ctrl_Echo;
import static org.balthie.cal.core.AbsCalculator.StandardInputerKey.Ctrl_Help;

import org.balthie.cal.core.HelpCmd;
import org.balthie.cal.core.IMathOperator;
import org.balthie.cal.impl.cmd.EchoCmd;
import org.balthie.cal.impl.cmd.EqualsCmd;
import org.balthie.cal.impl.cmd.GenericMathOptCmd;
import org.balthie.cal.impl.cmd.NumbCmd;
import org.balthie.cal.impl.cmd.RedoCmd;
import org.balthie.cal.impl.cmd.UndoCmd;

/**
 * @author：balthie@126.com
 * @createtime ： 2023年3月7日 下午1:37:55
 * @description 模拟一个有虚拟键盘（包含 10个整数，加减乘除符号、undo、redo 、= 共17个按键）、显示栏的计算器（类似手机计算器）
 * @since version 初始于版本 0.0.1-SNAPSHOT
 */
public class MojoCalculator extends BaseCalculator {

	public MojoCalculator() {
		super();
		registGenericInputer(Ctrl_Help.getKey(), new HelpCmd());
		// 控制指令按键
		registGenericInputer(Ctrl_Echo.getKey(), new EchoCmd());
		
		addButtonAlias(Ctrl_Echo, "Echo");
		registGenericInputer("Undo", new UndoCmd());
		registGenericInputer("Redo", new RedoCmd());

		// 运算符指令按键
		registGenericInputer("=", new EqualsCmd());

		// 自定义指令按键"Echo"
		registGenericInputer("二", new NumbCmd("2"));
		registGenericInputer("叄", new NumbCmd("3"));
		registGenericInputer("Ⅳ", new NumbCmd("4"));
		registGenericInputer("five", new NumbCmd("5"));
		registGenericInputer("加", new GenericMathOptCmd(IMathOperator.MathOperatorType.Add));
		registGenericInputer("substract", new GenericMathOptCmd(IMathOperator.MathOperatorType.Subtract));
		registGenericInputer("x", new GenericMathOptCmd(IMathOperator.MathOperatorType.Multiply));
		registGenericInputer("➗", new GenericMathOptCmd(IMathOperator.MathOperatorType.Divide));
	}

}
